<?php
	include("/include/config.php");
?>
<div id="main2">
		<div id="product">
			<div id="tproduct">
			<div class="tproduct"><p class="tp">Danh sách <?php echo $pageName;?>
</p></div>
			<div class="select">
			  </div></div>
			
			
<div id="listproduct">

<?php
	/*
	if (isset($_GET['from']))
		$from = $_GET['from'];
	else
		$from = 0;
	$to = $from + 7;
	*/
	$sql = "SELECT * FROM (subcategory INNER JOIN product ON subcategory.id=product.subcategory) WHERE subcategory.parent_id=$id ORDER By product.id DESC";// LIMIT $from,$to";
	$cmd = mysql_query($sql);
	if (!$cmd)
	{
		echo 'Danh mục này hiện không chứa sản phẩm!';
	}
	else
	{
		while ($rw = mysql_fetch_array($cmd))
		{
			
?>
			<div class="sanpham"><a href="product.php?id=<?php echo $rw['id'] ?>"><div id="anhsp"><img class="img" src="images/product/<?php echo $rw['image'];?>" border="0"/></a></div>
			<?php echo $rw['name']; ?><br />
			<p style="text-align:center">Mã SP: <?php echo $rw['code']; ?></p>
			<p class="gia"><?php echo number_format($rw['price'],0,',','.'); ?></p>
			<a href="product.php?cmd=add&id=<?php echo $rw["id"]?>"><img src="images/cho_vao_gio.png" border="0" /></a>
			<a href="buy.php?id=<?php echo $rw['id'] ?>"><img src="images/buy.png" boder="0"/></a>
			</div>
<?php

		}
	}
		
?>
			 </div>
			 
	
		</div>
